package org.raymond.iworks.apis;

import org.raymond.iworks.apis.common.Result;
import org.raymond.iworks.apis.vo.PageVO;
import org.raymond.iworks.apis.vo.role.*;
import org.raymond.iworks.apis.fallbackFactory.ITSysRoleServiceFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author raymond
 * @version V1.0
 */
//@Resource(name="role")
@FeignClient(name="services", contextId="role",
        fallbackFactory = ITSysRoleServiceFallbackFactory.class
)
public interface ITSysRoleServiceApi {
    //@Resource(name="role:edit")
    @PostMapping("/role/create")
    Result<Boolean> create(@Validated @RequestBody RoleCreateVO vo, BindingResult bindingResult);

    //@Resource(name="role:edit")
    @PostMapping("/role/update")
    Result<Boolean> update(@Validated @RequestBody RoleUpdateVO vo, BindingResult bindingResult);

    //@Resource(name="role:edit")
    @PostMapping("/role/delete")
    Result<Boolean> delete(@Validated @RequestBody RoleDelVO vo, BindingResult bindingResult);

    //@Resource(name="role:query")
    @GetMapping("/role/list")
    Result<PageVO<RoleInfoVO>> list(@SpringQueryMap RoleInfoVO vo);

    //@Resource(name="role:query")
    @GetMapping("/role/getById")
    Result<RoleInfoVO> getById(@RequestParam(value="id", required=true) Long id);
}
